<%@ page contentType="text/html;charset=UTF-8" %>

<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@ taglib uri = "/WEB-INF/tld/amway-html.tld"  prefix = "a" %>

<%@ page import="org.apache.struts.action.Action" %>
<%@ page import="org.apache.struts.action.ActionError" %>
<%@ page import="org.apache.struts.action.ActionErrors" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="org.apache.struts.Globals" %>
<%@ page import="com.vandagroup.common.resources.SysPara" %>
<%
response.setHeader("Expires","0");
response.setHeader("Pragma","nono-catch");
response.setHeader("Catch-Control","no-cache");
String _contexPath=request.getContextPath().equals("/")?"":request.getContextPath();
%>
<html>   
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="keywords" content="安利(中國)">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" type="text/css" href="<%=_contexPath%>/includes/css/credit.jsp">
<title>安利(中國)：用戶登錄</title>
</head>

<body onload="LoginForm.loginID.focus(); LoginForm.loginID.select()">
<table width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr>
    <td align="center" valign="middle">


    <table width="750" height="480" border="0" cellspacing="0" cellpadding="0" background="<%=_contexPath%>/includes/images/ns_login_bg.gif" 
        style="background-position: center; background-repeat: no-repeat">
    <tr>
        <td rowspan="2"><img src="<%=_contexPath%>/includes/images/ns_trans.gif" width="1" height="480"></td>
        <td><img src="<%=_contexPath%>/includes/images/ns_trans.gif" width="750" height="1"></td>
    </tr>
    <tr>
        <td align="left" valign="top">

        <div style="position: relative; width: 85px; height: 50px; left: 540px; top: 65px; z-index: 1">
        <table border="0" cellspacing="0" cellpadding="0" width="85" height="50" align="center" valign="middle">
        <tr>
            <td><img src="<%=_contexPath%>/includes/images/logo.gif" border="0" alt="安利(中國)"><br>版本號:  V1.0.00_QA(20090413)</td>
        </tr>
        </table>
        </div>

        <div style="position: relative;  width: 350px; height: 150px; left: 350px; top: 170px; z-index: 2">
        <table border="0" cellspacing="0" cellpadding="0" width="350" height="200" align="center" valign="middle">
        
        
        <html:form action="/Login" onsubmit="return validateForm()">
        <input type=hidden name="_$isLogin" value="EnterFromLogin">
        <input type=hidden name="operType" value="<%=SysPara.OPRTYPE_WORKER%>">
		
        <tr>
            <td><img src="<%=_contexPath%>/includes/images/ns1_left_top.gif"></td>
            <td background="<%=_contexPath%>/includes/images/ns1_top_bg.gif"><img src="<%=_contexPath%>/includes/images/ns_trans.gif"></td>
            <td><img src="<%=_contexPath%>/includes/images/ns1_right_top.gif"></td>
        </tr>
        <tr>
            <td background="<%=_contexPath%>/includes/images/ns1_left_bg.gif"><img src="<%=_contexPath%>/includes/images/ns_trans.gif"></td>
            <td bgcolor="#CCCCCC" width="100%" height="100%">
            <table align="center" valign="middle">
            <tr>
                <td colspan="2" align="center" style="color: #ff3000">
                <%
                ActionErrors actionErrors = (ActionErrors) request.getAttribute(Globals.ERROR_KEY);
                try {
                    if (actionErrors!=null && !actionErrors.empty()) {
                        out.println("登錄出錯：<br>");
                        Iterator errors = actionErrors.get();
                        while (errors.hasNext()) {
                            ActionError actionError = (ActionError) errors.next();
                            //out.println( actionError.getKey() + "<br>");
                            Object[] errorItem = actionError.getValues();
                            for( int i=0; i<errorItem.length; i++ ) {
                                out.println( "&nbsp;&nbsp;&nbsp;&nbsp;" + errorItem[i] + "&nbsp;&nbsp;<br>" );
                            }
                        }
                        out.println("<hr>");
                    }
                } catch ( Exception e ) {
                    out.println("e:" + e );
                }
                %> 
                </td>
            </tr>
            <tr>
                <td><bean:message key="prompt.loginID"/>：</td>
                <td><input type="text" name="loginID" size="15" maxlength=15></td>
            </tr>
            <tr>
                <td><bean:message key="prompt.password.custom"/>：</td>
                <td><input type=password name="password" size="15" maxlength=8></td>
            </tr>
            <tr>
                <td colspan="2" align="right">
                <html:submit value="登 錄" />&nbsp;
                <html:reset value="重 填" styleClass="btn"/>
                </td>
            </tr>
            </table>
            </td>
            <td background="<%=_contexPath%>/includes/images/ns1_right_bg.gif"><img src="<%=_contexPath%>/includes/images/ns_trans.gif"></td>
        </tr>
        <tr>
            <td><img src="<%=_contexPath%>/includes/images/ns1_left_bottom.gif"></td>
            <td background="<%=_contexPath%>/includes/images/ns1_bottom_bg.gif"><img src="<%=_contexPath%>/includes/images/ns_trans.gif"></td>
            <td><img src="<%=_contexPath%>/includes/images/ns1_right_bottom.gif"></td>
        </tr>
        </html:form>
        </table>
        </div>

        </td>
    </tr>
    </table>
    </td>
</tr>
</table>

<script>
function validateForm() {
    var loginId = LoginForm['loginID'].value ;
    var password = LoginForm['password'].value ;

    if (loginId == "") {
        alert("<a:message key="errors.required" arg0Key="prompt.loginID"/>") ;
        return false ;
    }
    
    if (password == "") {
        alert("<a:message key="errors.required" arg0Key="prompt.password.custom"/>") ;
        return false ;
    }
    return true ;    
}
</script>
 

</body>
</html>

